package org.idea.qiyu.framework.datasource.config;


/**
 * 获取当前线程持有的数据源
 *
 * @Author linhao
 * @Date created in 11:21 上午 2021/5/25
 */
public class DataSourceContextHolder {

    private static final ThreadLocal<String> datasourceContentHolder = new ThreadLocal<String>();

    public static void setDatasource(String datasourceName) {
        datasourceContentHolder.set(datasourceName);
    }

    public static String getDatasource() {
        return datasourceContentHolder.get();
    }

    public static void clearDatasource() {
        datasourceContentHolder.remove();
    }

}
